package com.geostar.constructionland.attachment.entity;

import org.apache.commons.lang3.StringUtils;

public class ZTreeNode {
	//id:'A', pId:'0', name:"A", open:false, nocheck: false
	
	private String pId;
	private String id;
	private String name;
	private boolean isParent;
	private String subPath;
	private String sourceId;
//	private String open;
//	private String nocheck;
	
	public ZTreeNode() {
		super();
	}
	public ZTreeNode(String pId, String id, String name, boolean isParent,
			String subPath, String sourceId) {
		super();
		this.pId = pId;
		this.id = id;
		this.name = name;
		this.isParent = isParent;
		this.subPath = subPath;
		this.sourceId = sourceId;
	}	
	public String getName() {
		return name;
	}
	public String getNamePlus() {
        if (isParent && StringUtils.isNotBlank(name)){
            return name + "/";
        }
        return name;
    }
	public String getpId() {
		return pId;
	}
	public void setpId(String pId) {
		this.pId = pId;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public void setName(String name) {
		String temp = name;
		//去除末尾"/"
		if (temp.endsWith("/")){
			temp = temp.substring(0, temp.lastIndexOf("/"));
		}
		this.name = temp;
	}
	public boolean getIsParent() {
		return isParent;
	}
	public void setIsParent(boolean isParent) {
		this.isParent = isParent;
	}
	public String getSubPath() {
		return subPath;
	}
	public void setSubPath(String subPath) {
		this.subPath = subPath;
	}
	public String getSourceId() {
		return sourceId;
	}
	public void setSourceId(String sourceId) {
		this.sourceId = sourceId;
	}
    @Override
    public String toString() {
        return "ZTreeNode [pId=" + pId + ", id=" + id + ", name=" + name
                + ", isParent=" + isParent + ", subPath=" + subPath
                + ", sourceId=" + sourceId + "]";
    }

}
